package com.bsoft.ecommerce.config;
//配置登录请求转发规则

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RouteLocatorConfig {
    //使用代码定义路由规则 在网关层面拦截登录和注册接口
    @Bean
   public RouteLocator loginRouteLocator(RouteLocatorBuilder builder){
       //手工定义Gateway 路由规则需要指定
        return  builder.routes()
                .route("e_commerce_authority",
                        r-> r.path("/imooc/e-commerce/login","imooc/e-commerce/register").uri("http://localhost:9000/")
                        ).build();
   }
}
